Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

242
Vistas
FirebaseError: Expected type "'Zu'", but it was: a custom ea object

I keep getting the error above when trying to sign in with Google on Firebase. My code

const provider = new GoogleAuthProvider();

export const auth = getAuth();

export async function signUpGoogle(userType) {
return await signInWithPopup(auth, provider)
    .then((result) => {
        // This gives you a Google Access Token. You can use it to access the Google API.
        const credential = GoogleAuthProvider.credentialFromResult(result);
        const token = credential.accessToken;
        // The signed-in user info.
        const user = result.user;
        // ...
        // create user in firestore
        //init services

        // Add a new document in collection "users"
        setDoc(collection(db, "users", "/", `${userType}`, '/', 'users'), {
            userId: user.uid,
            firstName: user.displayName,
            lastName: user.displayName,
            contactNumber: user.phoneNumber,
            county: "",
            idNumber: "",
            city: "",
            zipCode: "",
            fullName: "",
            email: user.email,
            imageAsUrl: {
                imageAsUrl: user.photoURL,
            },
        }).catch((e) => {
            console.log(e.toString());
        });
        sessionStorage.setItem("Auth Token", token);
        return true
    }).catch((error) => {
        // Handle Errors here.
        const errorCode = error.code;
        const errorMessage = error.message;
        // The email of the user's account used.
        const email = error.email;
        // The AuthCredential type that was used.
        const credential = GoogleAuthProvider.credentialFromError(error);
        console.log(errorCode, errorMessage);
        console.log(error);
        // ...
        return false
    });
   }

I have folowed the google documentation about signin with google and javascript

The error that i am getting is

FirebaseError: Expected type 'Zu', but it was: a custom ea object
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

The setDoc() takes a DocumentReference as a parameter i.e. you must specify the document ID. You can use addDoc() instead if you want to generate a random ID. But it might be useful to use user's UID as the document ID itself so try:

setDoc(doc(db, `users/${userType}/users/${user.uid}`), {
  userId: user.uid,
  firstName: user.displayName,
  // ...
}).catch((e) => {
  console.log(e.toString());
});
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda